home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / glimpsehttp / news / build_idx < prev    next >
Encoding:
Text File  |  1995-05-16  |  621 b   |  27 lines

  1. #!/bin/sh
  2.  
  3. # Build index on address
  4. # Fields of articles.db: article,ID,address,author,subject,date
  5.  
  6. # where your news archiving directory is
  7. HTTPD_NEWSHOME=/usr1/paul/news
  8.  
  9. cd $HTTPD_NEWSHOME/groups
  10. if [ ! -r newarticles ] ; then
  11.     exit    # no new articles
  12. fi
  13.  
  14. cat articles.db newarticles | sort -T . -ft'    ' | uniq >tmpidx$$
  15. mv tmpidx$$ articles.db
  16.  
  17. awk  -F'    ' 'BEGIN{OFS="\t"}
  18. {print $3,$1}' articles.db | sort -T . -ft'    ' >tmpidx$$
  19. mv tmpidx$$ by_addr.idx
  20.  
  21. # now index on article number
  22. awk  -F'    ' 'BEGIN{OFS="\t"}
  23. {print $2,$1}' articles.db | sort -T . -ft'    ' >tmpidx$$
  24. mv tmpidx$$ by_id.idx
  25.  
  26. rm -f newarticles tmpidx$$
  27.